using System.IO;
using System.Linq;

namespace Toast.Core
{
    public class WildCardFileMatcher : FileMatcher
    {
        public WildCardFileMatcher(string path)
            : base(path)
        {
        }

        public static string[] GetMatches(string path)
        {
            var wcm = new WildCardFileMatcher(path);
            return wcm.GetMatchingFiles();
        }

        public override string[] GetMatchingFiles()
        {
            return Directory.GetFiles(PhysicalDirectory, SearchPattern)
                .Select(x => VirtualDirectory + Path.DirectorySeparatorChar + Path.GetFileName(x)).ToArray();
        }
    }
}